package com.bill.common.system.action;

import com.bill.common.system.dto.ActivationCodeDTO;
import com.bill.common.system.service.IActivationCodeService;
import com.opensymphony.xwork2.ActionSupport;
import com.sinba.common.dto.PageDTO;

import org.springframework.beans.factory.annotation.Autowired;

@SuppressWarnings( "serial" )
public class ActivationCodeAction
    extends ActionSupport
{
    @Autowired
    private IActivationCodeService activationCodeService;
    private ActivationCodeDTO dto = new ActivationCodeDTO(  );
    private boolean result;
    private PageDTO pageDTO;
    private int page = 1;
    private int rows = 10;
    private String sidx;
    private String sord;
    private Long[] ids;

    public ActivationCodeDTO getDto(  )
    {
        return dto;
    }

    public void setDto( ActivationCodeDTO dto )
    {
        this.dto = dto;
    }

    public boolean isResult(  )
    {
        return result;
    }

    public void setResult( boolean result )
    {
        this.result = result;
    }

    public String getEmailActivationCode(  )
    {
        activationCodeService.getEmailActivationCode( dto );

        return SUCCESS;
    }

    public String authEmailCode(  )
    {
        result = activationCodeService.authEmailCode( dto );

        return "result";
    }

    public PageDTO getPageDTO(  )
    {
        return pageDTO;
    }

    public void setPageDTO( PageDTO pageDTO )
    {
        this.pageDTO = pageDTO;
    }

    public int getPage(  )
    {
        return page;
    }

    public void setPage( int page )
    {
        this.page = page;
    }

    public int getRows(  )
    {
        return rows;
    }

    public void setRows( int rows )
    {
        this.rows = rows;
    }

    public String getSidx(  )
    {
        return sidx;
    }

    public void setSidx( String sidx )
    {
        this.sidx = sidx;
    }

    public String getSord(  )
    {
        return sord;
    }

    public void setSord( String sord )
    {
        this.sord = sord;
    }

    public Long[] getIds(  )
    {
        return ids;
    }

    public void setIds( Long[] ids )
    {
        this.ids = ids;
    }

    public String findEmailAuthPager(  )
    {
        int start = ( page - 1 ) * rows;
        dto.setStart( start );
        dto.setLimit( rows );
        pageDTO = activationCodeService.emailAuthPages( dto, sord, sidx );
        pageDTO.setPage( page );
        pageDTO.setRows( rows );

        return SUCCESS;
    }

    public String deleteActionCodes(  )
    {
        activationCodeService.deleteActivationCode( ids );

        return SUCCESS;
    }
}
